﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models
{
    /// <summary>
    /// 非映射属性：表示不是表的字段 拓展属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class NonTableAttribute : Attribute
    {
        public NonTableAttribute(bool bIskey)
        {
            this.isNoField = bIskey;
        }
        private bool isNoField;
        public bool IsNonField
        {
            get { return isNoField; }
        }
    }
    /// <summary>
    /// 主键特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class PrimaryKeyAttribute : Attribute
    {
        public PrimaryKeyAttribute(bool bIspkey)
        {
            this.isPKey = bIspkey;
        }
        private bool isPKey;
        public bool IsPKey
        {
            get { return IsPKey; }
        }

    }
    /// <summary>
    /// 说明是否是自动增长列
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class IdentityAttribute : Attribute
    {
        public bool IsIdentity { get; set; }
    }
    [Serializable]
    public class Students
    {
        [Identity(IsIdentity = true)]
        [PrimaryKeyAttribute(true)]
        public int StudentId { get; set; }

        #region 普通属性
        public string StuName { get; set; }
        public int Age { get; set; }
        public DateTime CreateTime { get; set; }

        #endregion

        #region 拓展属性
        [NonTableAttribute(true)]
        public string ClassName { get; set; }
        #endregion

    }

}
